package com.kingoe.shardingdj.job;

import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.elasticjob.api.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
import org.springframework.stereotype.Component;

/**
 * 自定义定时任务
 * @author jinwu
 */
@Slf4j
@Component
public class MyJob1 implements SimpleJob {

    @Override
    public void execute(ShardingContext shardingContext) {
        log.info("自定义任务1执行");
        log.info(String.format("任务ID：%s; 分片数量: %s; 任务执行机器数量: %s; 自定义参数: %s",
                shardingContext.getTaskId(), shardingContext.getShardingTotalCount(),
                shardingContext.getShardingItem(), shardingContext.getShardingParameter()));
    }
}
